package com.demo.common.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * MybatisConfig
 * 
 * @author demo
 * @date 2020-10-27 10:49:19
 */
@Configuration
@EnableTransactionManagement
public class MybatisConfig {

    public static org.apache.ibatis.session.Configuration configuration() {
        org.apache.ibatis.session.Configuration configuration = new org.apache.ibatis.session.Configuration();
        // 设置驼峰
        configuration.setMapUnderscoreToCamelCase(true);
        // 设置超时
        configuration.setDefaultStatementTimeout(20);
        // 延迟加载
        configuration.setLazyLoadingEnabled(true);
        // 积极加载
        configuration.setAggressiveLazyLoading(false);
        return configuration;
    }

}
